
<?
	   layout("/inc/win_layout.html",{title:sysTitle}){
    ?>

<div class="row">
		<div class="col-lg-12">
				<div class="panel" >
					<div class="panel-heading">
						词表展示 <span class="subtitle">展示词表单个条目</span>
					</div>
					<div class="panel-body pan " style="width:auto;height:343px;overflow: auto;">
						<form action="#" class="form-horizontal">
							<div class="form-body pal"
								style="float:left;width:100%; overflow: auto;">
								<input id="id" type="hidden" class="form-control" />
						
								<div style=" padding-bottom: 20px;">
									<label for="categoryName" class="col-md-4 control-label">
										<div align="right">
											分类名称<span class='require' >*</span>
										</div> </label>
									<div class="col-md-8">
										<div class="input-icon">
											<input id="categoryName" type="text" class="form-control" />
										</div>
									</div>
								</div>


								<div style="padding-bottom: 20px;">
									<label for="categorySid" class="col-md-4 control-label">
										<div align="right">
											分类号<span class='require'>*</span>
										</div> </label>
									<div class="col-md-8">
										<div class="input-icon">
											<input id="categorySid" type="text" class="form-control" />
										</div>
									</div>
								</div>
								
								<div style="padding-bottom: 20px;">
										<label for="parentName" class="col-md-3 control-label">父节点
											<span class='require' id="paixu"></span> </label>
										<div class="col-md-8">
											<div class="input-group input-group-sm mbs">
												<input id="parentName" type="text" placeholder="根目录"
													class="form-control" disabled="true" /> <span
													class="input-group-btn"><button id="xuanze"
														onclick="saveEditZTree()" type="button"
														data-toggle="dropdown"
														class="btn btn-success dropdown-toggle">选择类..</button>
												</span>
											</div>
										</div>
								</div>
								<input id="parentId" type="hidden" class="form-control" />
							</div>
						</form>
					</div>
				</div>
		</div>
</div>

<?} ?>
<script>
	function getQueryString(name) { 
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
	var r = window.location.search.substr(1).match(reg); 
	if (r != null) return unescape(r[2]); return null; 
	} 
	var winName=getQueryString("winName");
	var index1 = window.parent.window[winName].getId();
	var classesId = window.parent.window[winName].getclassesId();
	//var index1 = window.parent.getId();
	$("#id").val(index1);
	$(function() {
		if (index1 != 0) {
			demo1();
		}
	});
	var index = parent.layer.getFrameIndex(window.name);
	function Page() {
				if($.trim($("#categoryName").val()).length<1) {
		        	alert('分类名称不能为空！');
		        	return null;
		        }
				if($.trim($("#categorySid").val()).length<1) {
		        	alert('分类号不能为空！');
		        	return null;
		        }
	
		$.ajax({
			type : "post",
			url : "./thesauriWordCategoryAddEdit.do",
			data : {
				"id" : index1,
				"categoryName" : $("#categoryName").val(),
				"categorySid" : $("#categorySid").val(),
				"parentId" :$("#parentId").val(),
				"classesId" :classesId,
			},
			dataType : "json",
			async : false,
			success : function(data) {
				if(data.count>0){
					window.parent.window[winName].initTree();
					window.parent.window[winName].layer.msg('提交成功');
					parent.layer.close(index);
				}
			},
			error : function(data) {
				alert("请求失败");
			}
		});
	}

	function demo1() {
		$.getJSON('./thesauriWordCategoryEditShow.do', {
			id : index1
		//向服务端传的参数，此处只是演示
		}, function(res) {
			//此处仅仅是为了演示变化的内容
			$("#categoryName").val(res[0].categoryName);
			$("#categorySid").val(res[0].categorySid);
			$("#parentId").val(res[0].parentId);
			$("#parentName").val(res[0].parentName);
		});
	};
	
	var gongYongZiDuan;
	function getGongYongZiDuan(){
		return gongYongZiDuan;
	}
	var inputPId;
	function getInputPId(){
		return inputPId;
	}
	var inputPName;
	function getInputPName(){
		return inputPName;
	}
	var thesauriWordCategoryId = 'null';
	function getThesauriWordCategoryId(){
		return thesauriWordCategoryId;
	}
	
	function getclassesIds(){
		return classesId;
	}
	
	
	function saveEditZTree() {
		gongYongZiDuan="叙词表范畴";
		inputPId="parentId";
		inputPName="parentName";
		parent.layer.open({
					type : 2,
					area : [ '650px', '600px' ],
					fix : false, //不固定
					//maxmin : true,
					scrollbar : false,
					shadeClose : true,
					title : '选择父节点',
					btn : [ '保存 ', '关闭' ],
					skin : 'layui-layer-rim', //加上边框
					content : ["word-thesauriWordCategoryAddEditFind-zTree.html?winName="+window.name,'no'],
					yes : function(index, layer) {
						//var iframeWin = window.parent.window[window.name].window['layui-layer-iframe'+ index];
						var iframeWin = parent.window[layer.find('iframe')[0]['name']];
						//alert(iframeWin);
						iframeWin.queren();
					},
					cancel : function(index) {
					}
				});
	};
</script>


